System for character validation and method therefor

ABSTRACT

Character validation systems and methods are implemented. Characters in a data processing system may be may be represented by a set of n-bit data values, however not all n-bit values necessarily represent valid characters. Each data value corresponding to a character of a stream of characters may be validated in response to a member of a data structure corresponding to the value, in which each member of the data structure includes validity information for a corresponding data value. The member may be addressed by indexing into the structure with the data value.

This application is a continuation of application Ser. No. 09/965,014,filed Sep. 27, 2001, status allowed.

TECHNICAL FIELD

The present invention relates in general to data processing systems, andin particular to parsing markup language character streams constitutingclient-server messages in a distributed data processing environment.

BACKGROUND INFORMATION

The development of computerized distribution information systems, suchas the Internet, allows users to link with servers and networks, andthus retrieve vast amounts of electronic information that was previouslyunavailable using conventional electronic media.

Users may be linked to the Internet through a hypertext based servicecommonly referred to as the World Wide Web (WWW). (The WWW may also beused in a broader sense to refer to the whole constellation of resourcesthat can be accessed using one or more of the protocols that embody theTCP/IP suite, described further below.) With the World Wide Web, anentity may register a “domain name” correlated with an electronicaddress (referred to an IP address) representing a logical node on theInternet and may create a “web page” or “page” that can provideinformation and some degree of interactivity.

The Internet is based upon a suite of communication protocols known asTransmission Control Protocol/Internet Protocol (TCP/IP) which sendspackets of data between a host machine, such as a server computer on theInternet commonly referred to as web server, and a client machine, suchas user's computer connected to the Internet. The WWW communications maytypically use the Hypertext Transfer Protocol (HTTP) which is supportedby the TCP/IP transmission protocols, however, file transfer and otherservices via the WWW may use other communication protocols, for examplethe File Transfer Protocol (FTP).

A computer user may “browse”, i.e., navigate around, the WWW byutilizing a suitable web browser, e.g., Netscape™, Internet Explorer™,and a network gateway, e.g., Internet Service Provider (ISP). A webbrowser allows the user to specify or search for a web page on the WWWand subsequently retrieve and display web pages on the user's computerscreen. Such web browsers are typically installed on personal computersor workstations to provide web client services, but increasingly may befound on other wired devices, for example personal digital assistants(PDA) or wireless devices such as cell phones.

As noted above, transactions between Web client and server may bedynamic and may be interactive. A user of a Web client may, for example,request information from the Web server, such as, by way of example, astock quotation (which is typically dynamic, that is changes over time),or product information (which may be static information maintained in adatabase by the provider of the Web server). The request message may becommunicated to the server in accordance with HTTP, and mayadditionally, be encapsulated in accordance with an information exchangeprotocol. One such open-architecture protocol is the Simple ObjectAccess Protocol (SOAP), which is a protocol for the exchange ofinformation in a distributed environment. (A specification for SOAP 1.1may be found in World Wide Web Consortium (W3C) Note 8 May 2000,copyright 2000, which is hereby incorporated herein by reference.) SOAPis an eXtensible Markup Language (XML) based protocol, whereby the SOAPmessage may be encoded using XML. (A markup language is a mechanism toidentify structures in a document, and an extensible markup languageconstitutes a meta-language for defining particular markup languages.XML is a particular extensible markup language, having, as recognized bythose in the art, an open specification. Another example is the StandardGeneralized Markup Language (SGML). Another, non-extensible, markuplanguage is the Hyptertext Markup Language (HTML).) Note that a requestmessage may include a remote procedure call (RPC) whereby a server-sideapplication procedure may be invoked to service the request. That is,the message may be an interapplication communication. SOAP messages maybe carried in HTTP, that is, may be embedded in an HTTP request. Hence,the SOAP provides a mechanism for carrying RPCs via HTTP. The responseto the request may be returned to the client via an HTTP responsecarrying a SOAP message encapsulating the response encoded as an XMLtext stream.

Thus, transactions between a client and server may include a sequence ofmessages each of which may constitute a stream of characters in whichthe characters are defined in accordance with a markup languagespecification. Each character stream may be parsed into elementsconstituting the message in accordance with the message encapsulationprotocol, such as the SOAP. The parser determines if the characters inthe stream are valid characters as defined in the markup languagespecification. Each character may be represented in accordance with themarkup language specification by an n-bit value, however not all n-bitvalues need necessarily represent a character within the specificationof a particular markup language. For example, in XML, characters arerepresented by sixteen-bit values, however, not all such valuescorrespond to valid characters in the XML specification. Typically,parsers validate characters by applying a set of “IF-THEN” rules.However, applying such a rule set, which may be complex, to validateeach character may consume significant data processing resources.Consequently, there is a need in the art for systems and methods forparsing character streams that reduce the consumption of processorresources, particularly processing cycles.

SUMMARY OF THE INVENTION

The aforementioned needs are addressed by the present invention.Accordingly, there are provided character validation systems andmethods. These include circuitry and steps, respectively, for retrievinga data value from a character stream. A validity of the characterrepresented by the value retrieved from the stream is determined inresponse to a member of a data structure corresponding to the value,wherein each member of the data structure includes validity informationfor a corresponding data value.

BRIEF DESCRIPTION OF THE DRAWINGS

For a more complete understanding of the present invention, and theadvantages thereof, reference is now made to the following descriptionstaken in conjunction with the accompanying drawings, in which:

FIG. 1 illustrates, in block diagram form, a client-server environmentwhich may be used in conjunction with the present invention;

FIG. 2 illustrates, in block diagram form, a data processing system inaccordance with an embodiment of the present invention;

FIG. 3 illustrates, in flow chart form, a methodology in accordance withan embodiment of the present invention;

FIG. 4 illustrates in tabular form, an data structure which may be usedin conjunction with the methodology of FIG. 3;

FIG. 5 illustrates, in flow chart form, a methodology for generating thedata structure of FIG. 4 in accordance with an embodiment of the presentinvention.

DETAILED DESCRIPTION

In the following description, numerous specific details are set forth toprovide a thorough understanding of the present invention. For example,character representations may be identified in accordance with andmarkup language specifications and operations may be described inconjunction with particular protocols, however it would be recognized bythose of ordinary skill in the art that the present invention may bepracticed without such specific details. In other instances, well-knowncircuits have been shown in block diagram form in order not to obscurethe present invention in unnecessary detail.

Refer now to the drawings wherein depicted elements are not necessarilyshown to scale and wherein like or similar elements are designated bythe same reference numeral through the several views.

Referring to FIG. 1 there is illustrated a Web client-server system 100,in accordance with the principles of the present invention. System 100includes one or more clients 102. Access to Web page data 104 ismediated via server 106 which includes markup language/object accessservice 108 in accordance with the principles of the present invention.Clients 102 may be coupled to server 106 via network 110, may be a localmachine or via a network which may be a local area network (LAN), widearea network (WAN), or the Internet.

Refer now to FIG. 2 which illustrates a data processing system 200 inaccordance with the principles of the present invention. System 200 maybe used in an embodiment of a client(s) 102 and server 106. System 200may include a central processing unit (CPU) 210 coupled to various othercomponents by system bus 212. An operating system 230 runs on CPU 210and provides control and coordinates the function of the variouscomponents in FIG. 2. Application 240 includes instructions for parsingmarkup language character streams including instructions for validatingcharacters therein in accordance with the principles of the presentinvention, and which will be described further in conjunction furtherwith FIGS. 3 and 4 herein below. It would be appreciated by those ofordinary skill in the art that the operations performed by theinstructions for parsing character streams would be similar in aclient-side embodiment of system 200 and a server-side embodiment ofsystem 200. Application 240 runs in conjunction with operating system230, which coordinates the internal functions of server 106, as would beunderstood by those of ordinary skill in the art. Additionally, readonly memory (ROM) 216 is coupled to system bus 212 and 5 includes abasic input/output system (BIOS) that control certain basic functions ofdata processing system 200. Random access memory (RAM) 214, disk adapter218 and communications adapter 234 are also coupled to system bus 212.It should be noted that software components including operating system230 and application 240 are loaded into RAM 214 which is the computersystems main memory. Disk adapter 218 may be a 10 Universal Serial Bus(USB) or other adapter that communicates with disk units 220. It isnoted that the program of the present invention may reside in disk unit220 and loaded into RAM 214 by operating system 230, as required.Communications adapter 234 interconnect bus 212 with a network, such asnetwork 1 10, FIG. 1.

Implementations of the invention include implementations as a computersystem programmed to execute the method or methods described herein, andas a computer program product. According to the computer systemimplementations, sets of instructions for executing the method ormethods are resident in the random access memory 214 of one or morecomputer systems configured generally as described above. Until requiredby server 106, the set of instructions may be stored as a computerprogram product in another computer memory, for example in disk drive220 (which may include a removable memory such as an optical disk orfloppy disk for eventual use in disk drive 220). Furthermore, thecomputer program product can also be stored in another computer andtransmitted when desired to the work station by a network or by anexternal network such as the Internet. One skilled in the art wouldappreciate that the physical storage of the sets of instructionsphysically changes the medium upon which it is stored so that the mediumcarries computer readable information. The change may be electrical,magnetic, chemical or some other physical change.

Refer now to FIG. 3 illustrating, in flowchart form, charactervalidation process 300. In step 302, a character stream is received. Thereceived character stream may be associated with a file constituting amessage in accordance with a markup language such as XML, as previouslydescribed. Additionally, as discussed hereinabove, the message may bepackaged in accordance with the SOAP.

In step 304, a value from the stream is retrieved. Note that eachcharacter in the stream constituting a message formatted in accordancewith a defined markup language may have a representation as ahexadecimal value. In general, the representation of characters in themarkup language may include a number, n, of bits, and such arepresentation my be used in conjunction with the present invention, aswould be appreciated by those of ordinary skill in the art. Recall,however, that not each hexadecimal (generally, n-bit) value necessarilycorresponds to a valid character.

In step 306, the hexadecimal value (or, generally, the n-bit value)corresponding to the character retrieved from the stream in step 304 isused as a pointer, or index into an array, or similar data structure.The array or similar data structure includes m entries, where m=2^(n).Thus, for a character representation by hexadecimal digits, the tablemay include 65536 entries. Each entry includes a field containing avalidity value. An exemplary array 400 is illustrated in FIG. 4. Array400 may embody character representations in accordance with the XML 1.0Specification (Second Edition), W3C Recommendation 6 Oct. 2000, which ishereby incorporated herein by reference. However, it would be understoodby ordinarily skilled artisans that other character representations asdefined in a specification for other markup languages may be used in anembodiment of array 400 in accordance with the present inventiveprinciples. (A process for generating such an array, or similar datastructure will be discussed in conjunction with FIG. 5.)

Pointer 402 indexes into array 400 and selects, in response to an n-bitcharacter representation a corresponding entry in the array. In column404, are illustrated hexadecimal values spanning the range [0, 2^(n)−1].Column 406 contains the base character status value for thecorresponding entries in array 400. A Boolean TRUE, represented by thevalue “1” in column 406 of array 400 denotes that the characterrepresented by the corresponding pointer is a base character. A BooleanFALSE, represented by the value “0” in column 406, indicates that thecharacter represented by the corresponding value is not a base character(but may be another character class). Additionally, each entry mayinclude additional fields associated with valid character attributes.For example, in XML, other character classes include a digit character,a combining character class, and extender character class and anideograph character class. Thus, in an array 400 in accordance with theXML 1.0 Specification, entry fields in columns 406-414 may include aBoolean status value denoting a status, or attribute, associated witheach valid character. Thus in array 400, the values 0x0041 and 0x0042represent valid base characters. (Hexadecimal values are denoted hereinwith the prefix 0x.) Similarly, column 408 may contain Boolean valuesdenoting the digit character class attribute, column 410 the extendercharacter class attribute, column 412 the combining character classattribute and 414 the ideograph character class attribute. In array 400,the value 0x0030 represents a valid digit character, the value 0x00B7 avalid extender character, the value 0x0300 a valid combining characterand the value 0x4E00 represents a valid ideograph character. In thisway, the validity of a data value as a valid representation of acharacter may be determined by reference to the status values in columns406-414 for the entry in array 400 corresponding to the data value. Ifall the status values are FALSE, then the data value does not correspondto a valid character. Thus, for example, in array 400, the hexadecimalvalue 0x0000 does not represent a valid markup language character.Likewise, the values 0xD800, 0xD801, 0xFFFE and 0xFFFF illustrated inarray 400 are invalid. Conversely, the values 0xD7FF, 0x0E00 and 0xFFFD,for example, represent valid characters. However, it would be recognizedby those of ordinary skill in the art that in other embodiments of array400 in accordance with other markup languages, the values 0x0000,0xD800, 0xD801, 0xFFFE and 0xFFFF may be valid and other hexadecimal(generally, n-bit) values may be invalid. Additionally, within the XMLSpecification, an alternative embodiment of array 400 may reference theletter character class in which valid characters having this attributewould be represent by the logical union of columns 406 and 414.

Returning to FIG. 3, in step 308, a validity value is tested. In anembodiment of the present invention in accordance with an array 400,FIG. 4, the validity value may be a logical combination of statusvalues. For example, in such an embodiment, the logical OR of theattribute values may be used. If, in step 310, the validity valuedenotes that the pointer value represents a valid character, is TRUE, or“1” then in step 312, the attribute values may, optionally, be read fromthe table. In step 314 it is determined if all characters in the streamhave been similarly validated. If not, process 300 proceeds to the nextcharacter, step 316, and returns to step 304 to continue validatingcharacters in the stream. Otherwise, all characters have been validated,in step 318, the syntactic rules for the markup language are applied tothe character stream. In applying the syntactic rules in step 316, theattributes optionally retrieved in step 311, if any, may be used. Forexample, if the character is a combining character, the character maybe, in accordance with XML, be associated with a namespace prefix.

Returning to step 310, if the validity value denotes that the pointervalue represents an invalid character, for example, in an embodiment inaccordance with array 400, FIG. 4, by determining that the value incolumn 406 of the entry pointed to in step 306 is FALSE, or “0” then, instep 320 an error response is generated. For example, a SOAP fault replymessage may be sent, or a program exceptional condition may be raised.

Refer now to FIG. 5, illustrating in flowchart form, a process 500 forgenerating an array which may be used in conjunction with a process forvalidating characters in a character stream in accordance with thepresent inventive principles. In an embodiment in which n-bit valuesrepresent characters, a loop with index, i, running from [0, 2^(n)−1] isentered, in step 502.

If, in step 504, the value i represents a valid character in accordancewith a markup language specification, then, in step 506, a status(equivalently, attribute) value a_(ik) is set to a logically “TRUE”value, where the character represented by the value i has the kthattribute of a set of j attributes. In other words, each valid characterbelongs to at least one of a number, j, of character classes. In step508, the remaining status values (a_(il), l≠k) in accordance with theparticular markup language specification are set to FALSE in thecorresponding fields of the ith array entry.

If, however in step 504, the value i does not represent a validcharacter, in step 510, all status values a_(il), l=1, . . . , j are setto a logically “FALSE” value. In step 512, process 500 proceeds to thenext value of the index i and returns to step 502 to fill the array, orsimilar data structure entries. Note that, as would be understood byordinarily skilled artisans, data structure pointers as used hereinrepresent relative indices from the beginning of the data structure orarray and absolute addresses may be generated by the operating system,which absolute addresses reflect the load address of the data structurein memory as well as the size of the array or data structure members.

Although the present invention and its advantages have been described indetail, it should be understood that various changes, substitutions andalterations can be made herein without departing from the spirit andscope of the invention as defined by the appended claims.

1. A data processing system comprising: a bus; a memory coupled to thebus, wherein the memory includes computer usable program code; and aprocessing unit coupled to the bus, wherein the processing unit executesthe computer usable program code to perform the steps of: receiving acharacter stream, wherein characters in the character stream are definedin accordance with a given markup language specification; retrieving adata value from the character stream; determining whether a characterrepresented by said data value is a valid character as defined in thegiven markup language specification, wherein determining whether saidcharacter represented by said data value is a valid character comprises:locating a member of a data structure, said member having a directcorrespondence to said retrieved data value; and determining whethersaid retrieved data value represents a valid character within the givenmarkup language specification according to a logical combination of aplurality of status values in said located member of said datastructure.
 2. The system of claim 1 wherein said data structurecomprises an array, and wherein said locating the member of the datastructure comprises: indexing into said array using said retrieved datavalue; and pointing to said member in said array in response to saidindexing.
 3. The system of claim 1 wherein the determining whether theretrieved data value represents a valid character within the givencomputer language according to a logical combination of a plurality ofstatus values in said located member of said data structure, comprisesdetermining whether the logical combination of the plurality of statusvalues corresponds to a logically “TRUE” value, wherein, if said logicalcombination corresponds to a logically “TRUE” value, said data valuerepresents a valid character.
 4. The system of claim 1 furthercomprising, if each character in said stream is a valid character, theprocessing unit executes the computer usable program code to perform thestep of applying a predetermined set of syntactic rules to byte patternscomprising said character stream.
 5. The system of claim 4 wherein saidgiven markup language comprises an extensible markup language.
 6. Thesystem of claim 5 wherein the extensible markup language comprises XML.7. The system of claim 1 further comprising the processing unit executesthe computer usable program code to perform the step of generating saiddata structure.
 8. A computer program product embodied in anon-transitory computer readable storage medium including programmingfor validation, the programming comprising a set of instructions forperforming the steps of: receiving a character stream, whereincharacters in the character stream are defined in accordance with agiven markup language specification; retrieving a data value from thecharacter stream; determining whether a character represented by saiddata value is a valid character as defined in the given markup languagespecification, wherein determining whether said character represented bysaid data value is a valid character comprises: locating a member of adata structure, said member having a direct correspondence to saidretrieved data value; and determining whether said retrieved data valuerepresents a valid character within the given markup languagespecification according to a logical combination of a plurality ofstatus values in said located member of said data structure.
 9. Theprogram product of claim 8 wherein said data structure comprises anarray, and wherein locating the member of the data structure comprises:indexing into said array using said retrieved data value; and pointingto said member in said array in response to said indexing step.
 10. Theprogram product of claim 8, wherein determining whether the retrieveddata value represents a valid character within the given computerlanguage according to a logical combination of a plurality of statusvalues in said located member of said data structure, comprisesdetermining whether the logical combination of the plurality of statusvalues corresponds to a logically “TRUE” value, wherein, if the logicalcombination of the plurality of status values corresponds to a logically“TRUE” value, said data value represents a valid character.
 11. Theprogram product of claim 8 further comprising instructions forperforming the step of, if each character in said stream is a validcharacter, applying a predetermined set of syntactic rules to bytepatterns comprising said character stream.
 12. The program product ofclaim 11 wherein said given markup language comprises an extensiblemarkup language.
 13. The program product of claim 12 wherein theextensible markup language comprises XML.
 14. The program product ofclaim 8 further comprising instructions for generating said datastructure.